package com.eazy.lkv2.core.aop;
import org.aspectj.lang.ProceedingJoinPoint;  
import org.aspectj.lang.annotation.Around;  
import org.aspectj.lang.annotation.Aspect;  
import org.aspectj.lang.annotation.Pointcut;
 
/**
 * 看名字就知道这个类是做什么得了吧。。。
 * @author apple
 */
@Aspect  
public class ServiceAop {  
  
	// 定义参考 http://www.cnblogs.com/yanjunwu/p/3996570.html
    @Pointcut("execution(* com.eazy.lkv2.web.service..*.* (..))")  
    public void makeOneCake() {  
    }  
  
    public void washOven() {  
        System.out.println("washOven,logging.....");  
    }  
  
    public void prepare() {  
        System.out.println("prepare,logging.....");  
    }  
  
    public void after() {  
        System.out.println("after someting to do,logging.....");  
    }  
  
    @Around(value = "makeOneCake()")  
    public void around(ProceedingJoinPoint joinPoint) throws Throwable {  
        washOven();  
        prepare();  
        String targetName = joinPoint.getTarget().getClass().getName();
        String methodName = joinPoint.getSignature().getName();
        long startTime = System.currentTimeMillis();  
        joinPoint.proceed();  
        long endTime = System.currentTimeMillis();  
        System.out.println("use time:" + (endTime - startTime));  
        after();  
    }  
  
}  